//
//  KDocumentDTO.m
//  KutulusLaw
//
//  Created by Mahmood1 on 12/10/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "KDocumentDTO.h"

@implementation KDocumentDTO
@synthesize xlsFile = _xlsFile, flvFile = _flvFile, mp3File = _mp3File, docFile = _docFile, pptFile = _pptFilex, fileMp4 = _fileMp4;

- (id)init {
	self = [super init];
	
	if (self) {
		self.xlsFile = @"";
		self.flvFile = @"";
		self.mp3File = @"";
		self.docFile = @"";
		self.pptFile = @"";
		self.imgFile = @"";
		self.fileMp4 = @"";
	}
	
	return self;
}
- (id)initWithDictionary:(NSDictionary *)dictionary {
	self = [super initWithDictionary:dictionary];
	
	if (self) {
		if ([dictionary objectForKey:@"pdf_file"]) {
			self.filePDF = [dictionary objectForKey:@"pdf_file"];
		}
		
		if ([dictionary objectForKey:kKEY_XLS_FILE]) {
			self.xlsFile = [dictionary objectForKey:kKEY_XLS_FILE] ;
		}
		
		if ([dictionary objectForKey:kKEY_FLV_FILE]) {
			self.flvFile = [dictionary objectForKey:kKEY_FLV_FILE] ;
		}
		
		if ([dictionary objectForKey:kKey_FILE_MP4]) {
			self.fileMp4 = [dictionary objectForKey:kKey_FILE_MP4] ;
		}
		
		if ([dictionary objectForKey:kKEY_MP3_FILE]) {
			self.mp3File = [dictionary objectForKey:kKEY_MP3_FILE] ;
		}
		
		if ([dictionary objectForKey:kKEY_DOC_FILE]) {
			self.docFile = [dictionary objectForKey:kKEY_DOC_FILE] ;
		}
		
		if ([dictionary objectForKey:kKEY_PPT_FILE]) {
			self.pptFile = [dictionary objectForKey:kKEY_PPT_FILE] ;
		}
		
		if ([dictionary objectForKey:kKEY_IMG_FILE]) {
			self.imgFile = [dictionary objectForKey:kKEY_IMG_FILE] ;
		}
	}
	
	return self;
}

- (id)copy {
    KDocumentDTO *searchFileDTO = [[KDocumentDTO alloc] init ];
    if (searchFileDTO) {
		searchFileDTO.ID = self.ID;
		searchFileDTO.userID = self.userID;
		searchFileDTO.name = [self.name copy];
		searchFileDTO.postDate = self.postDate;
		searchFileDTO.filePDF = [self.filePDF copy];	
		searchFileDTO.postDateText= [self.postDateText copy];
		searchFileDTO.createBy = [self.createBy copy];
		searchFileDTO.xlsFile = [self.xlsFile copy];
		searchFileDTO.flvFile = [self.flvFile copy];
		searchFileDTO.mp3File = [self.mp3File copy];
		searchFileDTO.docFile = [self.docFile copy];
		searchFileDTO.pptFile = [self.pptFile copy];
		searchFileDTO.imgFile = [self.imgFile copy];
		searchFileDTO.imgFile = [self.fileMp4 copy];
    }
    return self;
}

@end
